package com.socene.kotlin.dao

import com.socene.kotlin.entity.User
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param


/* *
 *Created by: Sorata 2017/11/9 0009 上午 10:38
 *
 */
interface UserRepository : JpaRepository<User, Int> {

    fun findByUsername(name: String): User?

    fun findByPassword(password: String, pageable: Pageable): Page<User>

    @Query("select u from User u where username = :name  and password = :password")
    fun selectUser(@Param("name")name: String, @Param("password") password: String): User?

}